from bs4 import BeautifulSoup

html = '''
终端输出的 HTML 代码内容
'''

soup = BeautifulSoup(html, 'html.parser')
links = soup.find_all('a', attrs={'name': 'g_href'})

for link in links:
    print(f"文本: {link.text.strip()}, 链接: {link.get('data-href')}")